package com.shadow.demo.data.mapping.controller;

import com.shadow.demo.data.mapping.common.DataConfigNode;
import com.shadow.demo.data.mapping.reader.DataMappingReader;
import com.shadow.demo.common.bo.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("mapping")
public class DataMappingController {

    @Resource
    private DataMappingReader dataMappingReader;

    /**
     * http://localhost:9113/dataMapping/mapping/data
     * */
    @GetMapping("data")
    public R data() throws IOException {
//        String s = dataMappingReader.readJsonFile();
        DataConfigNode<Map<String, Object>> jsonContent = dataMappingReader.getJsonContent();
        log.info(jsonContent.toString());
        return R.success();
    }

}
